<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui">

	<h:head><h1>Crea Volo</h1>
	
		<link type="text/css" href="../generalstyle.css" rel="stylesheet"/>
	
	</h:head>
<body>
	<img src="http://saraboargs.files.wordpress.com/2011/07/airbus-a340-airplanes.jpg" alt="" height="200" width="300" />
	 <h:form>
        <p:menubar>  
                <p:menuitem value="Home" url="../home.xhtml" />  
				<p:menuitem value="Area Cliente" url="../cliente/homeCliente.xhtml" />
				<p:menuitem value="Area Impiegato" url="../impiegato/homeImpiegato.xhtml" /> 
				<p:menuitem value="Login" url="../login.xhtml" rendered="#{request.remoteUser == null}" />
                <p:menuitem value="Logout" actionListener="#{logoutManagedBean.logout()}" rendered="#{request.remoteUser != null}" />
		</p:menubar>
		</h:form>
		<br></br>
	<p:button outcome="./visualizzaElementi.xhtml" value="Visualizza Elementi" />
	<h:form>
	<p:panel header="Crea Volo"  style="width:600px; margin:0 auto; text-align:center;">
			<h:panelGrid columns="3" id="regGrid">
	
					
					<p:outputLabel for="data" value="Data" />
					<p:calendar id="data" required="true" requiredMessage="Campo obbligatorio"
					value="#{ElementoManagedBean.dataCorrente}" navigator="true" yearRange="2014:2016"
				 mindate="#{ElementoManagedBean.todayDate}"  />
					<p:message for="data" />
					
					<p:outputLabel for="luogoPart" value="Luogo Partenza"/>
				    <p:inputText id="luogoPart" value="#{ElementoManagedBean.voloCorrente.luogoPartenza}" requiredMessage="Campo obbligatorio" required="true" />
					<p:message for="luogoPart" />
					
					<p:outputLabel for="luogoDest" value="Luogo Destinazione"/>
				    <p:inputText id="luogoDest" value="#{ElementoManagedBean.voloCorrente.luogoDestinazione}" requiredMessage="Campo obbligatorio" required="true" />
					<p:message for="luogoDest" />
					
					<p:outputLabel for="numeroPosti" value="Numero Posti" />
					<p:inputText id="numeroPosti" value="#{ElementoManagedBean.voloCorrente.numeroPosti}" requiredMessage="Campo obbligatorio" required="true">
					<f:validateLongRange minimum="1" />
					</p:inputText>
					<p:message for="numeroPosti" />
					
					<p:outputLabel for="descrizione" value="Descrizione" />
					<p:inputText id="descrizione" value="#{ElementoManagedBean.voloCorrente.descrizione}" />
					<p:message for="descrizione" />
					
					<p:outputLabel for="prezzo" value="Prezzo" />
					<p:inputText id="prezzo" value="#{ElementoManagedBean.voloCorrente.prezzo}" requiredMessage="Campo obbligatorio" required="true">
					<f:validateLongRange minimum="1" />
					</p:inputText>
					<p:message for="prezzo" />
					
			</h:panelGrid>

			<p:commandButton value="CREA" update="regGrid"
				action="#{ElementoManagedBean.creaVolo(ElementoManagedBean.voloCorrente)}" />

		</p:panel>
	
			
    </h:form>
</body>
</html>